package com.aletto.general_store.utils;

import android.app.Application;
import android.content.res.Resources;
import android.widget.Toast;

import com.aletto.general_store.GeneralStoreApplication;

import androidx.annotation.StringRes;

public class ToastUtils {

    private static Toast sToast;

    public static void makeText(@StringRes int stringRes) {
        Application context = GeneralStoreApplication.sInstance;
        makeText(context.getResources().getString(stringRes));
    }

    public static void makeText(String string) {
        if (sToast == null) {
            sToast = Toast.makeText(GeneralStoreApplication.sInstance, string, Toast.LENGTH_SHORT);
            //mToast.setGravity(Gravity.CENTER, 0, 0);
        } else {
            sToast.setText(string);
        }

        //sToast.setGravity(Gravity.CENTER, 0, 0);
        sToast.show();
    }

}
